import request, {headers} from '@/utils/request'
import qs from 'qs'
import da from "element-ui/src/locale/lang/da";

export default {
  connInfo(connParam){return request.get('/redis/monitor/connInfo',{params:{...connParam}})},
  slowlogs(connParam,nodeId){return request.get('/redis/monitor/slowlogs',{params:{...connParam,nodeId}})},
  clients(connParam,nodeId){return request.get('/redis/monitor/clientList',{params:{...connParam,nodeId}})},
  memory(connParam,nodeId){return request.get('/redis/monitor/memory',{params:{...connParam,nodeId}})},
  killClient(connParam,client,nodeId) {return request.post('/redis/monitor/client/kill',qs.stringify({...connParam,nodeId,...client}))},

  scan(connParam,scanParam,serializerParam){ return request.get('/redis/key/scan',{params:{...connParam,...scanParam,...serializerParam}})},
  hscan(connParam,hashKeyScanParam,serializerParam){return request.get('/redis/key/hscan',{params:{...connParam,...hashKeyScanParam,...serializerParam}})},
  delKeys(connParam,keys,serializerParam){return request.post('/redis/key/del',{connParam,keys,serializerParam},headers.json)},
  delFields(connParam,key,fields,serializerParam){return request.post('/redis/key/hash/hdel',{connParam,key,fields,serializerParam},headers.json)},
  readData(connParam,key,serializerParam,all,keyScanParam,rangeParam,scoreRangeParam){return request.post('/redis/data',{connParam,key,serializerParam,all,keyScanParam,rangeParam,scoreRangeParam},headers.json)},
  collectionMethods(connParam,members,command,serializerParam){ return request.get('/redis/collectionMethods',{params:{...connParam,members,command,...serializerParam}})},

  keyTree(connParam){return request.get('/redis/key/tree',{params:{...connParam}})},
  keyInfo(connParm,key,serializerParam){return request.get('/redis/key/info',{params:{...connParm,key,...serializerParam}})},
  delKeyPattern(connParam,keyPattern){return request.get('/redis/key/del/pattern',{params:{...connParam,keyPattern}})}
}
